package com.as.measurements.client.core.models;

/**
 * - 02/2008: Class created by Nicolas Richasse
 * 
 * Changelog:
 * 	- class created
 *  - modified by mcm
 * 
 * To do:
 * 	- ...
 */


import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Vector;

public class JperfStreamResult  implements Serializable
{
	private int									ID;
	private Vector<Measurement>	Bandwidth;
	private Vector<Measurement>	Jitter;
	private Vector<Measurement>	PacketLoss;
	private String interfName ;
	private Timestamp stamp;

	public Timestamp getStamp() {
		return stamp;
	}

	public void setStamp(Timestamp stamp) {
		this.stamp = stamp;
	}

	public JperfStreamResult(int i, String name)
	{
		ID = i;
		Bandwidth = new Vector<Measurement>();
		Jitter = new Vector<Measurement>();
		PacketLoss = new Vector<Measurement>();
		interfName = name;
	}

	public void addBW(Measurement M)
	{
		Bandwidth.add(M);
	}

	public String getInterfName() {
		return interfName;
	}

	public void setInterfName(String interfName) {
		this.interfName = interfName;
	}

	public void addJitter(Measurement M)
	{
		Jitter.add(M);
	}
	
	public void addPacketLoss(Measurement M)
	{
		PacketLoss.add(M);
	}

	public int getID()
	{
		return ID;
	}

	public void print()
	{
		for (int i = 0; i < Bandwidth.size(); ++i)
		{
			((Measurement) Bandwidth.get(i)).print();
		}
	}

	public Vector<Measurement> getBW()
	{
		return Bandwidth;
	}

	public Vector<Measurement> getJitter()
	{
		return Jitter;
	}
	
	public Vector<Measurement> getPacketLoss()
	{
		return PacketLoss;
	}

	public boolean equals(Object o)
	{
		return o instanceof JperfStreamResult && ((JperfStreamResult) o).ID == ID;
	}
}
